import {
  AddressShape,
  EventRecommendationShape,
  PhysicalItemRecommendationShape,
  TabSectionData,
} from "@/data/shared/entityShapes";
import { type } from "os";
import { detailsType } from "../shared/details";
import { ImageStringFormat, VideoStringFormat } from "../shared/mediaTypes";
import { DateShape, TimeShape } from "../shared/timeTypes";

export type CourseSchedulingShape = {
  schedulingId: number;
  courseName?: string;
  language: string;
  schedulingDate: DateShape;
  schedulingStartTime: TimeShape;
  schedulingEndTime: TimeShape;
  price: number;
  remainingSeatCount: number;
};

export enum ApiCourseTypes {
  Single = 0,
  Discovery = 1,
}

export type CourseFilterShape = {
  routine_course_price: {
    id: number;
    coursePrice: `${number}`;
    status: boolean;
  }[];
  routine_course_duration: {
    id: number;
    courseDuration: `${number}`;
    status: boolean;
  }[];
  routine_course_language: {
    id: number;
    courseLanguage: string;
    status: boolean;
  }[];
  routine_course_category: {
    id: number;
    courseTypeName: string;
    status: boolean;
  }[];
};

export interface CourseShape extends detailsType {
  status: Boolean;
  id: number;
  name: string;
  typeName: string;
  typeLabelColor: string;
  type: ApiCourseTypes;
  duration: number;
  introduction: string;
  price: number;
  cover: string;
  carouselMap: ImageStringFormat[];
  isAppointment?: Boolean;
  isCollection?: Boolean;
  isDeleted?: number;
  totalSeatsLeftForAllScheduledCourses?: number;
  orderQuantityToBeWrittenOff?: number;
  completedOrderQuantity?: number;
  quantityOfOrdersToBeEvaluated?: number;
  sharePoster: string; // Can be empty string
  mainPictureVideo: VideoStringFormat | "";

  courseInfo?: TabSectionData;

  schedulingList: Array<
    {
      courseId: number;
      name: string;
      schedulings: CourseSchedulingShape[];
    } & AddressShape
  >;

  eventRecommendations?: EventRecommendationShape[];
  shopRecommendations?: PhysicalItemRecommendationShape[];
}

export type CourseListShape = {
  id: number;
  name: string;
  typeName: string;
  type: ApiCourseTypes;
  typeLabelColor: string;
  price: string;
  cover: ImageStringFormat;
  schedulingDate: DateShape;
  schedulingStartTime: TimeShape;
  schedulingEndTime: TimeShape;
}[];

export type CourseListShapeFilter = {
  id: number;
  name: string;
  carouselMap: String;
  cover: ImageStringFormat;
  introduction: string;
  courseAddressId: number;
  courseDurationId: number;
  coursePriceId: number;
  courseTypeId: number;
  createTime: string;
  isDeleted: number;
  isRecycle: boolean;
  mainPictureVideo: string;
  seatCount: number;
  sharePoster: string;
  sort: number;
  status: boolean;
  updateTime: string;
}[];
